package facilius.controller.actionmanager;

import facilius.controller.ActionManager;
import facilius.controller.action.disciplina.DisciplinaCreateAction;
import facilius.controller.action.disciplina.DisciplinaDeleteAction;
import facilius.controller.action.disciplina.DisciplinaReadAction;
import facilius.controller.action.disciplina.DisciplinaShowFormAction;
import facilius.controller.action.disciplina.DisciplinaUpdateAction;
import org.mentawai.authorization.Permission;
import org.mentawai.core.ActionConfig;
import org.mentawai.core.ApplicationManager;
import org.mentawai.core.Forward;
import org.mentawai.core.Redirect;
import org.mentawai.filter.AuthorizationFilter;

/**
 *
 * @author Graciano
 */
public class DisciplinaActionManager implements ActionManager{

    public void loadActions(ApplicationManager appManager) {
        ActionConfig ac = null;
        ac = new ActionConfig("DisciplinaRead",DisciplinaReadAction.class);
        ac.addConsequence(appManager.SUCCESS, new Forward("jsp/disciplina/disciplinaList.page"));
        ac.addConsequence(appManager.EXCEPTION, new Forward("jsp/erro.page"));
        ac.addFilter(new AuthorizationFilter(new Permission("disciplina")));
        appManager.addActionConfig(ac);

        ac = new ActionConfig("DisciplinaShowForm",DisciplinaShowFormAction.class);
        ac.addConsequence(appManager.SUCCESS, new Forward("jsp/disciplina/disciplinaForm.page"));
        ac.addConsequence(appManager.ERROR, new Forward("jsp/erro.page"));
        ac.addFilter(new AuthorizationFilter(new Permission("disciplina")));
        appManager.addActionConfig(ac);

        ac = new ActionConfig("DisciplinaCreate", DisciplinaCreateAction.class);
        ac.addConsequence(appManager.SUCCESS, new Redirect("DisciplinaRead.mtw"));
        ac.addConsequence(appManager.ERROR, new Forward("jsp/erro.page"));
        ac.addFilter(new AuthorizationFilter(new Permission("disciplina")));
        appManager.addActionConfig(ac);

        ac = new ActionConfig("DisciplinaDelete",DisciplinaDeleteAction.class);
        ac.addConsequence(appManager.SUCCESS, new Redirect("DisciplinaRead.mtw"));
        ac.addConsequence(appManager.ERROR, new Forward("jsp/erro.page"));
        ac.addFilter(new AuthorizationFilter(new Permission("disciplina")));
        appManager.addActionConfig(ac);

        ac = new ActionConfig("DisciplinaUpdate",DisciplinaUpdateAction.class);
        ac.addConsequence(appManager.SUCCESS, new Redirect("DisciplinaRead.mtw"));
        ac.addConsequence(appManager.ERROR, new Forward("jsp/erro.page"));
        ac.addFilter(new AuthorizationFilter(new Permission("disciplina")));
        appManager.addActionConfig(ac);
    }

}
